
<script setup>
import  {ref, watch } from 'vue'
import LLMFlow from './components/LLMFlow.vue'
import ChatView from './components/ChatView.vue'

import  {darkTheme, useMessage } from 'naive-ui'
import hljs from 'highlight.js/lib/core';
import javascript from 'highlight.js/lib/languages/javascript';
import css from 'highlight.js/lib/languages/css';
import json from 'highlight.js/lib/languages/json';
// import html from 'highlight.js/lib/languages/html';
import golang from 'highlight.js/lib/languages/go';
import typescript from 'highlight.js/lib/languages/typescript';
import java from 'highlight.js/lib/languages/java';
import python from 'highlight.js/lib/languages/python';
import bash from 'highlight.js/lib/languages/bash';
import Login from "./components/Login.vue"

hljs.registerLanguage('javascript', javascript);
hljs.registerLanguage('bash', bash);
hljs.registerLanguage('python', python);
hljs.registerLanguage('css', css);
hljs.registerLanguage('json', json);

hljs.registerLanguage('golang', golang);
hljs.registerLanguage('java', java);
hljs.registerLanguage('typescript', typescript);
const theme = darkTheme;
const chats = ref({
})
// const messager = useMessage()
const chatids = ref([]);
const tasks = ref({})
const nodes = ref([
  {
    "id":"node-network-ddg",
    "type":"network",
    "position":{x:350 , y:50},
  }
]);
const login = ref({
  username:"",
  password:"",
  code:"",
});
const logined = ref(false);


</script>

<template>
  <n-config-provider :hljs="hljs">
    
      <n-message-provider>
        <n-dialog-provider>

          <main style="width: 100vw; height: 100vh; background:#000">
            <n-config-provider :theme="darkTheme">

              <!-- <n-tabs  type="line" animated style="padding-left:10px;height: 100vh;background: #1e1e1e" :theme="darkTheme" > -->
              <n-tabs v-if="logined == true"  type="line" animated style="padding-left:10px;height: 100vh;background: #1e1e1e" :theme="darkTheme" >
                <n-tab-pane name="chat" tab="对话" display-directive="show:lazy" >
                  <ChatView v-model:sessionName="login.username" v-model:tasks="tasks" v-model:nodes="nodes" v-model:chats="chats" v-model:chatids="chatids" v-model:login="login" />
                </n-tab-pane>
                <n-tab-pane display-directive="show:lazy"  name="task" tab="任务模式">
                  <LLMFlow v-model:tasks="tasks" v-model:login="login" v-model:nodes="nodes" />
                </n-tab-pane>
                
                
              </n-tabs>
              <Login v-else v-model:login="login"  v-model:logined="logined" v-model:chats="chats" v-model:chatids="chatids" />
            </n-config-provider>
          </main>
        </n-dialog-provider>
      </n-message-provider >

  </n-config-provider>
</template>
